<template>
    <view class="container">
        <view>
            <navbar title="首页" :isBack="false"></navbar>
        </view>
        <view class="grid">
            <u-grid :col="3">
                <u-grid-item @click="toExam">
                    <i class="iconfont icon-kaoshi"></i>
                    <view class="grid-text">开始考试</view>
                </u-grid-item>
                <u-grid-item @click="toHistory">
                    <i class="iconfont icon-lishijilu"></i>
                    <view class="grid-text">历史考试</view>
                </u-grid-item>
                <u-grid-item @click="toAchievement">
                    <i class="iconfont icon-chengji"></i>
                    <view class="grid-text">成绩分析</view>
                </u-grid-item>
            </u-grid>
        </view>
        <view class="body">
            <template v-if="exams.length===0">
                <u-empty></u-empty>
            </template>
            <template v-else>
                <u-table></u-table>
            </template>
        </view>
        <tabbar :current="0"></tabbar>
        <view>
        </view>
    </view>
</template>

<script>
    export default {
        data() {
            return {
                exams: []
            }
        },
        methods: {
            toExam() {
                uni.navigateTo({
                    url: "/pages/exam/index"
                })
            },
            toHistory() {
                uni.navigateTo({
                    url: "/pages/history/index"
                })
            },
            toAchievement() {
                uni.navigateTo({
                    url: "/pages/achievement/index"
                })
            }
        }
    }
</script>

<style>
    .grid {
        height: 3.9rem;
    }

    .body {
        height: calc(100vh - 7rem);
        overflow: auto
    }
</style>